// Fileinput.less
// CSS for file upload button and fileinput widget
// ------------------------------------------------

.btn-file {
  overflow: hidden;
  position: relative;
  vertical-align: middle;
  > input {
    position: absolute;
    top: 0;
    right: 0;
    margin: 0;
    opacity: 0;
    filter: alpha(opacity=0);
    font-size: 23px;
    height: 100%;
    width: 100%;
    direction: ltr;
    cursor: pointer;

    &::-webkit-file-upload-button {
      cursor: pointer;
    }
  }
}

.fileinput {
  margin-bottom: 9px;
  display: inline-block;
  max-width: 100vw;
  .form-control {
    padding-top: 7px;
    padding-bottom: 5px;
    display: inline-block;
    margin-bottom: 0px;
    vertical-align: middle;
    cursor: text;
  }
  .img-thumbnail {
    overflow: hidden;
    display: inline-block;
    margin-bottom: 5px;
    vertical-align: middle;
    text-align: center;
    > img {
      max-height: 100%;
      max-width: 100%;
      height: auto;
      margin-right: auto;
      margin-left: auto;
      display: block;
    }
  }
  .btn {
    vertical-align: middle;
  }
  .form-group {
    overflow: hidden;
    .fileinput-filename {
      width: 90%;
      width: calc(100% - 20px);
    }
  }
}
.fileinput-exists .fileinput-new,
.fileinput-new .fileinput-exists {
  display: none;
}

//close X button alignment
.fileinput-exists.close {
  float: none;
}

.fileinput-inline .fileinput-controls {
  display: inline;
}

.fileinput-filename {
  display: inline-block;
  overflow: hidden;
  vertical-align: middle;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 65%;
}

.form-control .fileinput-filename {
  vertical-align: bottom;
  white-space: nowrap;
  width: 100%;
  max-width: 100%;
  position: absolute;
  left: 0;
  padding-left: 10px;
}

.form-control .fileinput-filename.with-icon {
  padding-left: 30px;
}

.fileinput.input-group {
    display: flex;

    > * {
        position: relative;
        z-index: 2;
    }
    > .btn-file {
        z-index: 1;
    }
}

.fileinput .input-group-append .input-group-text:hover {
  background: #d9dcdf;
  cursor: pointer;
}

.form-group.has-warning .fileinput {
  .fileinput-preview {
    color: @state-warning-text;
  }
  .img-thumbnail {
    border-color: @state-warning-border;
  }
}
.form-group.has-error .fileinput {
  .fileinput-preview {
    color: @state-danger-text;
  }
  .img-thumbnail {
    border-color: @state-danger-border;
  }
}
.form-group.has-success .fileinput {
  .fileinput-preview {
    color: @state-success-text;
  }
  .img-thumbnail {
    border-color: @state-success-border;
  }
}


// Input group fixes

.input-group-addon:not(:first-child) {
  border-left: 0;
}
